package com.clouddot.baipai.ui.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.clouddot.baipai.R;
import com.clouddot.baipai.http.entity.response.getCourseByIdResponse;

import java.util.List;

/**
 * Created by wxy on 2018/8/26.
 */

public class HomeWorkAdapter extends BaseQuickAdapter<getCourseByIdResponse.courseInfoByid, BaseViewHolder> {

    public HomeWorkAdapter(List<getCourseByIdResponse.courseInfoByid> mDataList) {
        super(R.layout.h_adapter_homework_item, mDataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, final getCourseByIdResponse.courseInfoByid item) {
        helper.setText(R.id.name, item.Title);
        helper.getView(R.id.name).setSelected(item.flag);
        helper.setOnClickListener(R.id.name, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onClicked(item);
            }
        });


    }

    private AdapterItemClickListener listener;

    public void setOnClickListener(AdapterItemClickListener listener) {
        this.listener = listener;
    }

    public interface AdapterItemClickListener {
        void onClicked(getCourseByIdResponse.courseInfoByid position);
    }


}
